<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Bayesian Network: bayesian/network/adjacency_list.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Bayesian Network
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_4922399365a46b010edf8e4eee2a5dfb.html">bayesian</a></li><li class="navelem"><a class="el" href="dir_56c81f943e16f382d13475f1c8bedad4.html">network</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">adjacency_list.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="adjacency__list_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef BAYESIAN_NETWORKS_NETWORK_ADJACENCY_LIST_HPP</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define BAYESIAN_NETWORKS_NETWORK_ADJACENCY_LIST_HPP</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span> <span class="comment">//find_if</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;list&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="component_8hpp.html">bayesian/network/component.hpp</a>&gt;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="traits_8hpp.html">bayesian/network/traits.hpp</a>&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacebn.html">bn</a> {</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html">   22</a></span>&#160;<span class="keyword">class </span><a class="code" href="classbn_1_1adjacency__list.html">adjacency_list</a> {</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">using</span> <a class="code" href="classbn_1_1adjacency__list.html">this_type</a> = <a class="code" href="classbn_1_1adjacency__list.html#a56528f0e620055a956b3b76f21474b52">adjacency_list</a>;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="keyword">using</span> node_ptr = component::node_ptr;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keyword">using</span> arc_ptr = component::arc_ptr;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">using</span> node_const_ptr = <a class="code" href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">traits::add_const_shared_t&lt;component::node_ptr&gt;</a>;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="keyword">using</span> arc_const_ptr = <a class="code" href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">traits::add_const_shared_t&lt;component::arc_ptr&gt;</a>;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keyword">using</span> stored_node_type = std::list&lt;node_ptr&gt;;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keyword">using</span> stored_arc_type = std::list&lt;arc_ptr&gt;;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keyword">using</span> endpoint_dictionary_type =</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        std::unordered_map&lt;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;            arc_const_ptr,</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;            std::pair&lt;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                node_const_ptr,</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                node_const_ptr&gt;&gt;;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keyword">using</span> adjacency_type =</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        std::unordered_map&lt;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;            node_const_ptr,</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;            std::list&lt;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;                std::pair&lt;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                    node_const_ptr,</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                    arc_const_ptr&gt;&gt;&gt;;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <a class="code" href="classbn_1_1adjacency__list.html#a56528f0e620055a956b3b76f21474b52">adjacency_list</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <a class="code" href="classbn_1_1adjacency__list.html#a56528f0e620055a956b3b76f21474b52">adjacency_list</a>(<a class="code" href="classbn_1_1adjacency__list.html">this_type</a> <span class="keyword">const</span>&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <a class="code" href="classbn_1_1adjacency__list.html#a56528f0e620055a956b3b76f21474b52">adjacency_list</a>(<a class="code" href="classbn_1_1adjacency__list.html">this_type</a>&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="classbn_1_1adjacency__list.html#adfed1578ea650163d81f45ad158c39a1">~adjacency_list</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a96bb46a6180c3a5c15dd63918975ee8e">   64</a></span>&#160;    <a class="code" href="classbn_1_1adjacency__list.html">this_type</a>&amp; <a class="code" href="classbn_1_1adjacency__list.html#a96bb46a6180c3a5c15dd63918975ee8e">operator=</a>(<a class="code" href="classbn_1_1adjacency__list.html">this_type</a> <span class="keyword">const</span>&amp; rhs)</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    {</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        *<span class="keyword">this</span> = <a class="code" href="classbn_1_1adjacency__list.html">adjacency_list</a>{ rhs };</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    }</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    this_type&amp; <a class="code" href="classbn_1_1adjacency__list.html#a96bb46a6180c3a5c15dd63918975ee8e">operator=</a>(this_type&amp;&amp;) = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#abf24ef021137fdd8e500ec8dd6749774">   80</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__list.html#abf24ef021137fdd8e500ec8dd6749774">add_node</a>(node_ptr <span class="keyword">const</span>&amp; node)</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        stored_node_.push_back(node);</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        {</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;            adjacency_[node].clear();</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        }</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        <span class="keywordflow">catch</span>(std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        {</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            stored_node_.pop_back();</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        <span class="keywordflow">return</span> node;</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    }</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#ac1c9a5cf37ca7bffd406b813f0b59428">  102</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__list.html#ac1c9a5cf37ca7bffd406b813f0b59428">remove_node</a>(node_ptr <span class="keyword">const</span>&amp; node) noexcept</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    {</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <span class="keyword">auto</span> it = std::find(stored_node_.crbegin(), stored_node_.crend(), node);</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="keywordflow">if</span>(it == stored_node_.crend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        <span class="comment">// Backup for Strong Guarantee</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="keyword">auto</span> backup_stored_arc = stored_arc_;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="keyword">auto</span> backup_endpoint_dic = endpoint_dic_;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keyword">auto</span> backup_adjacency = adjacency_;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        <span class="comment">// Delete arcs connecting to the node</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <span class="keywordtype">bool</span> is_error = <span class="keyword">false</span>;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; arc : backup_stored_arc)</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            <span class="keyword">auto</span> <span class="keyword">const</span> it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;            <span class="keywordflow">if</span>(it == endpoint_dic_.cend())</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            {</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                is_error = <span class="keyword">true</span>;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                <span class="keywordflow">break</span>;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            }</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;            <span class="keywordflow">if</span>(it-&gt;second.first == node || it-&gt;second.second == node)</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;            {</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                <span class="keywordflow">if</span>(!this-&gt;<a class="code" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">remove_arc</a>(arc))</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                {</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;                    is_error = <span class="keyword">true</span>;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                    <span class="keywordflow">break</span>;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;                }</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            }</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        }</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="comment">// Restore</span></div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        <span class="keywordflow">if</span>(is_error)</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        {</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;            stored_arc_ = std::move(backup_stored_arc);</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            endpoint_dic_ = std::move(backup_endpoint_dic);</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            adjacency_ = std::move(backup_adjacency);</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        }</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        <span class="comment">// Success</span></div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        adjacency_.erase(node);</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        stored_node_.erase((++it).base());</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    }</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a287ac7e2fd3df22e35f5a7b27986a770">  155</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1adjacency__list.html#a287ac7e2fd3df22e35f5a7b27986a770">add_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc, node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to)</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    {</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        <span class="keyword">auto</span> node_pair = std::make_pair(from, to);</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        <span class="keyword">auto</span> arc_pair = std::make_pair(to, arc);</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        stored_arc_.push_back(arc);</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        <span class="keywordflow">try</span></div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        {</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            endpoint_dic_[arc] = std::move(node_pair);</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            <span class="keywordflow">try</span></div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;            {</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                adjacency_[from].push_back(std::move(arc_pair));</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            }</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">catch</span>(std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            {</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                endpoint_dic_.erase(arc);</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;                <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            }</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        }</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        <span class="keywordflow">catch</span>(std::exception <span class="keyword">const</span>&amp;)</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        {</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            stored_arc_.pop_back();</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;            <span class="keywordflow">throw</span>;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;        }</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;        <span class="keywordflow">return</span> arc;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    }</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">  189</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">remove_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc) noexcept</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    {</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        <span class="keyword">auto</span> it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;        <span class="keywordflow">if</span>(it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">remove_arc</a>(arc, it-&gt;second.first, it-&gt;second.second);</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    }</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;</div><div class="line"><a name="l00204"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a8caaa67f706804674614981631cf43fb">  204</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__list.html#a8caaa67f706804674614981631cf43fb">remove_arc</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to) noexcept</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    {</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        <span class="keyword">auto</span> endpoint_it = std::find_if(</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;            endpoint_dic_.cbegin(), endpoint_dic_.cend(),</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            [&amp;from, &amp;to](<span class="keyword">auto</span> <span class="keyword">const</span>&amp; elem){</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;                        <span class="keywordflow">return</span> elem.second.first == from &amp;&amp; elem.second.second == to;</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                    });</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;        <span class="keywordflow">if</span>(endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">remove_arc</a>(std::const_pointer_cast&lt;component::arc&gt;(endpoint_it-&gt;first), from, to);</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    }</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;</div><div class="line"><a name="l00223"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#ab6c3b0389bd180830d86d1dd1ac7eac3">  223</a></span>&#160;    arc_ptr <a class="code" href="classbn_1_1adjacency__list.html#ab6c3b0389bd180830d86d1dd1ac7eac3">is_adjacent</a>(node_ptr <span class="keyword">const</span>&amp; from, node_ptr <span class="keyword">const</span>&amp; to) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;    {</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> endpoint_it = std::find_if(</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;            endpoint_dic_.cbegin(), endpoint_dic_.cend(),</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;            [&amp;from, &amp;to](<span class="keyword">auto</span> <span class="keyword">const</span>&amp; elem) {</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                <span class="keywordflow">return</span> elem.second.first == from &amp;&amp; elem.second.second == to;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;            });</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keywordflow">if</span>(endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        <span class="keywordflow">return</span> std::const_pointer_cast&lt;<a class="code" href="classbn_1_1component_1_1arc.html">component::arc</a>&gt;(endpoint_it-&gt;first);</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;    }</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;</div><div class="line"><a name="l00244"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a48be8e72365ef266b83b33a6f3c65e41">  244</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classbn_1_1adjacency__list.html#a48be8e72365ef266b83b33a6f3c65e41">is_connect</a>(node_ptr <span class="keyword">const</span>&amp; node, arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;    {</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;        <span class="keyword">auto</span> <span class="keyword">const</span> endpoint_it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;        <span class="keywordflow">if</span>(endpoint_it == endpoint_dic_.cend()) <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;        <span class="keywordflow">return</span> endpoint_it-&gt;second.first  == node ?  1 :</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;               endpoint_it-&gt;second.second == node ? -1 :</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;                                                     0 ;</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    }</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;</div><div class="line"><a name="l00260"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#acba5fbbf9149f26dbb56feecaa6ab4d8">  260</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__list.html#acba5fbbf9149f26dbb56feecaa6ab4d8">source</a>(arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    {</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;        <span class="keyword">auto</span> it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        <span class="keywordflow">if</span>(it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;        <span class="keywordflow">return</span> std::const_pointer_cast&lt;<a class="code" href="classbn_1_1component_1_1node.html">component::node</a>&gt;(it-&gt;second.first);</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    }</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;</div><div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a9c23312b4b02d4eb7ab0384ae03b96dc">  274</a></span>&#160;    node_ptr <a class="code" href="classbn_1_1adjacency__list.html#a9c23312b4b02d4eb7ab0384ae03b96dc">target</a>(arc_ptr <span class="keyword">const</span>&amp; arc) <span class="keyword">const</span> noexcept</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    {</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;        <span class="keyword">auto</span> it = endpoint_dic_.find(arc);</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;        <span class="keywordflow">if</span> (it == endpoint_dic_.cend()) <span class="keywordflow">return</span> <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;</div><div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;        <span class="keywordflow">return</span> std::const_pointer_cast&lt;<a class="code" href="classbn_1_1component_1_1node.html">component::node</a>&gt;(it-&gt;second.second);</div><div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;    }</div><div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;</div><div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;</div><div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#ab0ac355e7ff890c1c23aefef0a2ef8bc">  288</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__list.html#ab0ac355e7ff890c1c23aefef0a2ef8bc">parent_nodes</a>(node_ptr <span class="keyword">const</span>&amp; child)<span class="keyword"> const</span></div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;        std::vector&lt;node_ptr&gt; nodes;</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        nodes.reserve(stored_node_.size());</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; endpoint : endpoint_dic_)</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;        {</div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;            <span class="keywordflow">if</span>(endpoint.second.second == child)</div><div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;                nodes.push_back(std::const_pointer_cast&lt;component::node&gt;(endpoint.second.first));</div><div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;        }</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;        nodes.shrink_to_fit();</div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;        <span class="keywordflow">return</span> nodes;</div><div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    }</div><div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;</div><div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;</div><div class="line"><a name="l00309"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#acc77c52a720bdebd1b656cda969d2513">  309</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__list.html#acc77c52a720bdebd1b656cda969d2513">child_nodes</a>(node_ptr <span class="keyword">const</span>&amp; parent)<span class="keyword"> const</span></div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;        std::vector&lt;node_ptr&gt; nodes;</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;        nodes.reserve(stored_node_.size());</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        <span class="keywordflow">for</span>(<span class="keyword">auto</span> <span class="keyword">const</span>&amp; adjacent : adjacency_.at(parent))</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;            nodes.push_back(std::const_pointer_cast&lt;component::node&gt;(adjacent.first));</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;        nodes.shrink_to_fit();</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;        <span class="keywordflow">return</span> nodes;</div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    }</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div><div class="line"><a name="l00322"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#a0a629f2d67914c2b3c93da9ea2e5db83">  322</a></span>&#160;    std::vector&lt;node_ptr&gt; <a class="code" href="classbn_1_1adjacency__list.html#a0a629f2d67914c2b3c93da9ea2e5db83">all_node</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;        <span class="keywordflow">return</span> std::vector&lt;node_ptr&gt;(stored_node_.cbegin(), stored_node_.cend());</div><div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    }</div><div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;</div><div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="classbn_1_1adjacency__list.html#afa3c371db2f5fca960ee20a5281bea8e">  328</a></span>&#160;    std::vector&lt;arc_ptr&gt; <a class="code" href="classbn_1_1adjacency__list.html#afa3c371db2f5fca960ee20a5281bea8e">all_arc</a>()<span class="keyword"> const</span></div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;<span class="keyword">    </span>{</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;        <span class="keywordflow">return</span> std::vector&lt;arc_ptr&gt;(stored_arc_.cbegin(), stored_arc_.cend());</div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    }</div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">remove_arc</a>(arc_ptr <span class="keyword">const</span>&amp; arc, node_const_ptr <span class="keyword">const</span>&amp; from, node_const_ptr <span class="keyword">const</span>&amp; to) noexcept</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    {</div><div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keyword">auto</span> arc_it = std::find(stored_arc_.crbegin(), stored_arc_.crend(), arc);</div><div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;        <span class="keywordflow">if</span>(arc_it == stored_arc_.crend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;</div><div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;        <span class="keyword">auto</span> from_it = adjacency_.find(from);</div><div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;        <span class="keywordflow">if</span>(from_it == adjacency_.cend()) <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160;</div><div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;        <span class="keyword">auto</span>&amp; adjacency = from_it-&gt;second;</div><div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;        <span class="keyword">auto</span> adjacency_it = std::find(adjacency.cbegin(), adjacency.cend(), std::pair&lt;node_const_ptr, arc_const_ptr&gt;(to, arc));</div><div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;        <span class="keywordflow">if</span> (adjacency_it == adjacency.cend()) <span class="comment">//? May I remove this &#39;if&#39; statement?</span></div><div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">// Not registered</span></div><div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;</div><div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;        adjacency.erase(adjacency_it);</div><div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;        endpoint_dic_.erase(arc);</div><div class="line"><a name="l00349"></a><span class="lineno">  349</span>&#160;        stored_arc_.erase((++arc_it).base());</div><div class="line"><a name="l00350"></a><span class="lineno">  350</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00351"></a><span class="lineno">  351</span>&#160;    }</div><div class="line"><a name="l00352"></a><span class="lineno">  352</span>&#160;</div><div class="line"><a name="l00353"></a><span class="lineno">  353</span>&#160;    stored_node_type stored_node_;</div><div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160;    stored_arc_type stored_arc_;</div><div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;    endpoint_dictionary_type endpoint_dic_;</div><div class="line"><a name="l00356"></a><span class="lineno">  356</span>&#160;    adjacency_type adjacency_;</div><div class="line"><a name="l00357"></a><span class="lineno">  357</span>&#160;};</div><div class="line"><a name="l00358"></a><span class="lineno">  358</span>&#160;</div><div class="line"><a name="l00359"></a><span class="lineno">  359</span>&#160;} <span class="comment">// namespace bn</span></div><div class="line"><a name="l00360"></a><span class="lineno">  360</span>&#160;</div><div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;<span class="preprocessor">#endif // BAYESIAN_NETWORKS_NETWORK_ADJACENCY_LIST_HPP</span></div><div class="ttc" id="classbn_1_1adjacency__list_html_abf24ef021137fdd8e500ec8dd6749774"><div class="ttname"><a href="classbn_1_1adjacency__list.html#abf24ef021137fdd8e500ec8dd6749774">bn::adjacency_list::add_node</a></div><div class="ttdeci">node_ptr add_node(node_ptr const &amp;node)</div><div class="ttdoc">Register a node into network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:80</div></div>
<div class="ttc" id="namespacebn_html"><div class="ttname"><a href="namespacebn.html">bn</a></div><div class="ttdef"><b>Definition:</b> algorithm.hpp:16</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a48be8e72365ef266b83b33a6f3c65e41"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a48be8e72365ef266b83b33a6f3c65e41">bn::adjacency_list::is_connect</a></div><div class="ttdeci">int is_connect(node_ptr const &amp;node, arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Check whether a node and an arc are connected in the network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:244</div></div>
<div class="ttc" id="classbn_1_1component_1_1node_html"><div class="ttname"><a href="classbn_1_1component_1_1node.html">bn::component::node</a></div><div class="ttdoc">A class representing a node in network. </div><div class="ttdef"><b>Definition:</b> component.hpp:30</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_acba5fbbf9149f26dbb56feecaa6ab4d8"><div class="ttname"><a href="classbn_1_1adjacency__list.html#acba5fbbf9149f26dbb56feecaa6ab4d8">bn::adjacency_list::source</a></div><div class="ttdeci">node_ptr source(arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Obtain a source (parent) node of an arc. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:260</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a9c23312b4b02d4eb7ab0384ae03b96dc"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a9c23312b4b02d4eb7ab0384ae03b96dc">bn::adjacency_list::target</a></div><div class="ttdeci">node_ptr target(arc_ptr const &amp;arc) const noexcept</div><div class="ttdoc">Obtain a target (child) node of an arc. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:274</div></div>
<div class="ttc" id="traits_8hpp_html"><div class="ttname"><a href="traits_8hpp.html">traits.hpp</a></div><div class="ttdoc">Implementation of traits in bn::network. </div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_afa3c371db2f5fca960ee20a5281bea8e"><div class="ttname"><a href="classbn_1_1adjacency__list.html#afa3c371db2f5fca960ee20a5281bea8e">bn::adjacency_list::all_arc</a></div><div class="ttdeci">std::vector&lt; arc_ptr &gt; all_arc() const</div><div class="ttdoc">Obtain all arc pointers. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:328</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_ab0ac355e7ff890c1c23aefef0a2ef8bc"><div class="ttname"><a href="classbn_1_1adjacency__list.html#ab0ac355e7ff890c1c23aefef0a2ef8bc">bn::adjacency_list::parent_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; parent_nodes(node_ptr const &amp;child) const</div><div class="ttdoc">Obtain a list of all nodes which are parent of the child (argument). </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:288</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a0a629f2d67914c2b3c93da9ea2e5db83"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a0a629f2d67914c2b3c93da9ea2e5db83">bn::adjacency_list::all_node</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; all_node() const</div><div class="ttdoc">Obtain all node pointers. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:322</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_ac1c9a5cf37ca7bffd406b813f0b59428"><div class="ttname"><a href="classbn_1_1adjacency__list.html#ac1c9a5cf37ca7bffd406b813f0b59428">bn::adjacency_list::remove_node</a></div><div class="ttdeci">bool remove_node(node_ptr const &amp;node) noexcept</div><div class="ttdoc">Remove the argument node from network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:102</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a96bb46a6180c3a5c15dd63918975ee8e"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a96bb46a6180c3a5c15dd63918975ee8e">bn::adjacency_list::operator=</a></div><div class="ttdeci">this_type &amp; operator=(this_type const &amp;rhs)</div><div class="ttdoc">(Copy operator=) Initialize nodes and arcs by copying a parameter. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:64</div></div>
<div class="ttc" id="component_8hpp_html"><div class="ttname"><a href="component_8hpp.html">component.hpp</a></div><div class="ttdoc">Implementations of important elements of bn::network. </div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a56528f0e620055a956b3b76f21474b52"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a56528f0e620055a956b3b76f21474b52">bn::adjacency_list::adjacency_list</a></div><div class="ttdeci">adjacency_list()=default</div><div class="ttdoc">(Default ctor) Initialize nodes and arcs as empty. </div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a287ac7e2fd3df22e35f5a7b27986a770"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a287ac7e2fd3df22e35f5a7b27986a770">bn::adjacency_list::add_arc</a></div><div class="ttdeci">arc_ptr add_arc(arc_ptr const &amp;arc, node_ptr const &amp;from, node_ptr const &amp;to)</div><div class="ttdoc">Register an arc into network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:155</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_adfed1578ea650163d81f45ad158c39a1"><div class="ttname"><a href="classbn_1_1adjacency__list.html#adfed1578ea650163d81f45ad158c39a1">bn::adjacency_list::~adjacency_list</a></div><div class="ttdeci">virtual ~adjacency_list()=default</div><div class="ttdoc">(Default dtor) </div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a889cf34dd957108c100a5686d5db02dc"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a889cf34dd957108c100a5686d5db02dc">bn::adjacency_list::remove_arc</a></div><div class="ttdeci">bool remove_arc(arc_ptr const &amp;arc) noexcept</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:189</div></div>
<div class="ttc" id="classbn_1_1component_1_1arc_html"><div class="ttname"><a href="classbn_1_1component_1_1arc.html">bn::component::arc</a></div><div class="ttdoc">A class representing a arc in network. </div><div class="ttdef"><b>Definition:</b> component.hpp:52</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_acc77c52a720bdebd1b656cda969d2513"><div class="ttname"><a href="classbn_1_1adjacency__list.html#acc77c52a720bdebd1b656cda969d2513">bn::adjacency_list::child_nodes</a></div><div class="ttdeci">std::vector&lt; node_ptr &gt; child_nodes(node_ptr const &amp;parent) const</div><div class="ttdoc">Obtain a list of all nodes which are child of the parent (argument). </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:309</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_ab6c3b0389bd180830d86d1dd1ac7eac3"><div class="ttname"><a href="classbn_1_1adjacency__list.html#ab6c3b0389bd180830d86d1dd1ac7eac3">bn::adjacency_list::is_adjacent</a></div><div class="ttdeci">arc_ptr is_adjacent(node_ptr const &amp;from, node_ptr const &amp;to) const noexcept</div><div class="ttdoc">Check whether two nodes are adjacent by a arc in the network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:223</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html_a8caaa67f706804674614981631cf43fb"><div class="ttname"><a href="classbn_1_1adjacency__list.html#a8caaa67f706804674614981631cf43fb">bn::adjacency_list::remove_arc</a></div><div class="ttdeci">bool remove_arc(node_ptr const &amp;from, node_ptr const &amp;to) noexcept</div><div class="ttdoc">Remove the argument arc from network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:204</div></div>
<div class="ttc" id="classbn_1_1adjacency__list_html"><div class="ttname"><a href="classbn_1_1adjacency__list.html">bn::adjacency_list</a></div><div class="ttdoc">Implement class of adjacency list for bn::network. </div><div class="ttdef"><b>Definition:</b> adjacency_list.hpp:22</div></div>
<div class="ttc" id="traits_8hpp_html_aa44fb0011435752a09a0f9b519f8d863"><div class="ttname"><a href="traits_8hpp.html#aa44fb0011435752a09a0f9b519f8d863">bn::traits::add_const_shared_t</a></div><div class="ttdeci">typename add_const_shared&lt; T &gt;::type add_const_shared_t</div><div class="ttdoc">Change shared_ptr&lt;T&gt; into shared_ptr&lt;const T&gt;. </div><div class="ttdef"><b>Definition:</b> traits.hpp:25</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
